﻿@{
    Layout = "~/Views/Shared/OA/_Tree.cshtml";
}
@section Toolbar
{
    @Html.MyNet().Button(new ButtonOptions { Text = "审核通过", Click = "setStatus(1)" })
    @Html.MyNet().Button(new ButtonOptions { Text = "审核不通过", Click = "setStatus(2)" })
    @Html.MyNet().Button(new ButtonOptions { Text = "删除", Click = "removee" })
}

@section Main
{
    <div id="grid" class="grid">
    </div>
    <div id="pager" class="pager">
    </div>
}
<script type="text/javascript">
    var url = "/CMS/Comment/";

    jQuery(function () {
        read();
    });

    function create() {
        nav(url + "create");
    }

    function modify() {
        if (!gridSelected()) return alert("未选中任何节点！");
        nav(url + "Modify?Id=" + gridSelected());
    }

    function removee() {
        if (!gridSelected()) return alert("未选中任何节点！");
        if (!confirm("确定要删除选中的数据吗？")) return;

        $.ajax
            ({
                url: url + "Remove",
                data: { ids: gridSelected() },
                type: "post",
                error: disposeError,
                success: function (result) {
                    if (disposeException(result)) return;
                    read();
                }
            });
    }

    function setStatus(status) {
        if (!gridSelected()) return alert("未选中任何节点！");
        if (!confirm("确定要删除选中的数据吗？")) return;

        $.ajax
            ({
                url: url + "SetStatus",
                data: { ids: gridSelected(), status: status },
                type: "post",
                error: disposeError,
                success: function (result) {
                    if (disposeException(result)) return;
                    read();
                }
            });
    }

    function detail() {
        nav(url + "detail");
    }

</script>
